//
//  UIView+ZCHelp.m
//  UniversalApp
//
//  Created by 凯朱 on 2019/5/31.
//  Copyright © 2019 徐阳. All rights reserved.
//

#import "UIView+ZCHelp.h"

@implementation UIView (ZCHelp)
/**
 *  自动从xib创建视图
 */
+(instancetype)viewFromXIB{
    
    NSString *name = NSStringFromClass(self);
    
    UIView *xibView = [[[NSBundle mainBundle] loadNibNamed:name owner:nil options:nil] firstObject];
    
    return xibView;
}

-(void)setTextFieldPlaceholdarWithStr:(NSString *)placeholdar textColor:(UIColor *)textColor font:(UIFont *)font{
    UITextField *textField = (UITextField *)self;
    if (font == nil) {
        font = kFont(18);
    }
    if (textColor == nil) {
        textColor = KColor_4;
    }
    textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:kSTRING(placeholdar) attributes:@{NSFontAttributeName:font,NSForegroundColorAttributeName:textColor}];
}
@end
